import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const routes = [
  {
    path: '/opinion/list',
    name: 'OpinionList',
    component: () => import('@/components/opinion/List.vue'),
    meta: {
      keepAlive: true
    }
  },
  {
    path: '/opinion/detail',
    name: 'OpinionDetail',
    component: () => import('@/components/opinion/Detail.vue'),
    meta: {
      keepAlive: true
    }
  },
  {
    path: '/opinion/view',
    name: 'OpinionView',
    component: () => import('@/components/opinion/View.vue'),
    meta: {
      keepAlive: true
    }
  },
  {
    path: '/',
    redirect: '/opinion/list'
  }
]

export default new Router({
  routes,
  scrollBehavior (to, from, savePosition) {
    if (savePosition) {
      return savePosition
    } else {
      return { x: 0, y: 0 }
    }
  }
})
